#include "concurrent/queue.hpp"

#include <thread>
#include <iostream>
#include <unistd.h>

using namespace std;
using namespace cxx_study::concurrent;

class Point {
public:
  Point(int x, int y) : x(x), y(y) {}

private:
  int x, y;
};

void test_emplace() {
  queue<Point> q;
  q.emplace<int, int>(3, 4);
  q.emplace(5, 6);
}

int main() {
  test_emplace();

  queue<int> queue(256);

  thread t1([&] {
    for (int i = 0; true; i++) {
      queue.push(i);
      if (i > 1024)sleep(1);
    }
  });

  thread t2([&] {
    while (true) {
      cout << queue.pop() << endl;
    }
  });

  getchar();
  return 0;
}